<?php
App::uses('AppController', 'Controller');
/**
 * Articles Controller
 *
 * @property Article $Article
 * @property PaginatorComponent $Paginator
 */
class ProductBrandController extends AppController {

/**
 * Components
 *
 * @var array
 */
	public $components = array('Paginator');

	/**
	 * view method
	 *
	 * @return void
	 */
	public function view($id=null) 
	{
		$this->set('products', $this->Paginator->paginate());
		if (!$this->ProductBrand->exists($id)) {
			throw new NotFoundException(__('Invalid Product Brand'));
		}
		$this->set('band', $this->ProductBrand->findById($id));
		$this->loadModel('ProductCategory');
		$options = array('conditions' => array('ProductCategory.product_brand_id' => $id), 'order' => array('ProductCategory.category_name_en' => 'ASC'));
		
		$this->ProductCategory->recursive = -1;
		$this->set('categoryList', $this->ProductCategory->find('all', $options));
		//$this->ProductBrand->recursive = -1;
		//$this->set('brands', $this->ProductBrand->find('all'));
	}
}
